<template>
  <div style="background-color:#e9eef3">
    <el-container>
      <el-header>
        <components-header></components-header>
      </el-header>
      <el-container>
        <el-aside width="200px">
        <components-aside></components-aside>
        </el-aside>
        <el-main>
            <div v-if="isShow" class="personal">
                <ComponentsPersonal></ComponentsPersonal>
            </div>
            <router-view v-if="!isShow"></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
    import ComponentsAside from '../components/ComponentsAside.vue'
    import ComponentsHeader from '../components/ComponentsHeader.vue'
    import ComponentsPersonal from '../components/ComponentsPersonal.vue'
    export default {
    name: "Main",
    data() {
      return {
          isShow:true
      }
    },
    mounted() {
        this.$bus.$on('isShowMeun',(obj)=>{
          if (obj) {
            this.isShow = false
          }
        })
        this.$bus.$on('personalCenter',(obj)=>{
          //替换两者的参数
          this.isShow = obj
          //刷新页面
          location.reload()
        })
    },
    components:{ComponentsAside,ComponentsHeader,ComponentsPersonal}
    };
</script>

<style scoped>
.el-header {
  background-color: #b3c0d1;
  color: #333;
  text-align: center;
  line-height: 60px;
}
.el-aside {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  line-height: 200px;
  height: 91.5vh;
}
.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  line-height: 30px; 
}
.personal{
  width: 100%;
  height: 100%;
}

</style>